//
//  CartViewController.m
//  SXH
//
//  Created by Jack on 15/9/2.
//  Copyright (c) 2015年 lyss. All rights reserved.
//

#import "CartViewController.h"
#import "CartTableViewCell.h"

@interface CartViewController ()

@end

@implementation CartViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark -
#pragma mark Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    //    return [mutableArrayOrder count];
    return 2;
}

#pragma mark - tableView headView
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 40.0;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40)];
    headView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:1];
    
    UIImage *image = [UIImage imageNamed:@"trade_choose_default@2x.png"];
    UIImageView *businessLogo = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 30, 30)];
    [businessLogo setImage:image];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 150, 40)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textColor = [UIColor darkGrayColor];
    titleLabel.font = [UIFont systemFontOfSize:13];
    titleLabel.text = @"扬州舜天国际旅行社";
    
    UIImage *imageArrow = [UIImage imageNamed:@"3.png"];
    UIImageView *arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(200, 10, 20, 20)];
    [arrowView setImage:imageArrow];
    
    UILabel *orderTagLabel = [[UILabel alloc] initWithFrame:CGRectMake(headView.frame.size.width-40, 0, 40, 40)];
    orderTagLabel.backgroundColor = [UIColor clearColor];
    orderTagLabel.textColor = [UIColor darkGrayColor];
    orderTagLabel.font = [UIFont systemFontOfSize:13];
    orderTagLabel.text = @"编辑";
    
    [headView addSubview:businessLogo];
    [headView addSubview:titleLabel];
    [headView addSubview:arrowView];
    [headView addSubview:orderTagLabel];
    
    return headView;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *couponTableViewCellIdentifier=@"CartTableViewCell";
    CartTableViewCell *cell = (CartTableViewCell *)[tableView dequeueReusableCellWithIdentifier:couponTableViewCellIdentifier];
    if (cell == nil) {
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"CartTableViewCell" owner:self options:nil];
        cell = [array objectAtIndex:0];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 100;
}

#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

#pragma mark------全选按钮
- (IBAction)allSelectAction:(id *)sender
{
    //TODO:
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"CartViewController"];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"CartViewController"];
}
@end
